package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.OrderitemAirportservice;
import com.ktgj.service.service.IOrderitemAirportserviceService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 机场服务订单明细Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/airportservice")
public class OrderitemAirportserviceController extends BaseController
{
    @Autowired
    private IOrderitemAirportserviceService orderitemAirportserviceService;

    /**
     * 查询机场服务订单明细列表
     */
    @PreAuthorize(hasPermi = "service:airportservice:list")
    @GetMapping("/list")
    public TableDataInfo list(OrderitemAirportservice orderitemAirportservice)
    {
        startPage();
        List<OrderitemAirportservice> list = orderitemAirportserviceService.selectOrderitemAirportserviceList(orderitemAirportservice);
        return getDataTable(list);
    }

    /**
     * 导出机场服务订单明细列表
     */
    @PreAuthorize(hasPermi = "service:airportservice:export")
    @Log(title = "机场服务订单明细 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderitemAirportservice orderitemAirportservice) throws IOException
    {
        List<OrderitemAirportservice> list = orderitemAirportserviceService.selectOrderitemAirportserviceList(orderitemAirportservice);
        ExcelUtil<OrderitemAirportservice> util = new ExcelUtil<OrderitemAirportservice>(OrderitemAirportservice.class);
        util.exportExcel(response, list, "机场服务订单明细 数据");
    }

    /**
     * 获取机场服务订单明细详细信息
     */
    @PreAuthorize(hasPermi = "service:airportservice:query")
    @GetMapping(value = "/{orderitemId}")
    public AjaxResult getInfo(@PathVariable("orderitemId") Long orderitemId)
    {
        return AjaxResult.success(orderitemAirportserviceService.selectOrderitemAirportserviceById(orderitemId));
    }

    /**
     * 新增机场服务订单明细
     */
    @PreAuthorize(hasPermi = "service:airportservice:add")
    @Log(title = "机场服务订单明细 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderitemAirportservice orderitemAirportservice)
    {
        return toAjax(orderitemAirportserviceService.insertOrderitemAirportservice(orderitemAirportservice));
    }

    /**
     * 修改机场服务订单明细
     */
    @PreAuthorize(hasPermi = "service:airportservice:edit")
    @Log(title = "机场服务订单明细 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderitemAirportservice orderitemAirportservice)
    {
        return toAjax(orderitemAirportserviceService.updateOrderitemAirportservice(orderitemAirportservice));
    }

    /**
     * 删除机场服务订单明细
     */
    @PreAuthorize(hasPermi = "service:airportservice:remove")
    @Log(title = "机场服务订单明细 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderitemIds}")
    public AjaxResult remove(@PathVariable Long[] orderitemIds)
    {
        return toAjax(orderitemAirportserviceService.deleteOrderitemAirportserviceByIds(orderitemIds));
    }
}
